package com.elh.nio.test;


import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * @author liulei
 **/
public class Client1 {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost",8088);
        char[] chars = new char[3];
        System.out.println("连接结束");
        InputStream inputStream = socket.getInputStream();
        InputStreamReader reader = new InputStreamReader(inputStream);
        int read = 0;
        while ((read = (reader.read(chars))) != -1){
            System.out.println(new String(chars,0,read));
        }
        System.out.println();
        inputStream.close();
        socket.close();
    }

}
